package com.pinyougou.manager.controller;


import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/login")
public class Login {
    @RequestMapping("/name")
    public Map login() {
        String name = SecurityContextHolder.getContext().getAuthentication().getName();
        HashMap<String, String> loginName = new HashMap<>();
        loginName.put("loginName", name);
        return loginName;
    }

}
